package frame;

import java.awt.Graphics;

import javax.swing.JPanel;

public class ClientPanel extends JPanel{
	private int[][] chess=new int[19][19];
	private int posX;
	private int posY;
	@Override
	public void paint(Graphics g) {
		int size=30;
		 super.paint(g);
		 g.drawImage(ImageResource.IMAGE_CHESS, 0, 0, 600, 600, this);	
		 for(int i=0;i<19;i++){
			 for(int j=0;j<19;j++){
				 if(i==posX&&j==posY){
					 if(chess[i][j]==1){
						 g.drawImage(ImageResource.IMAGE_WHITE_NOW, i*size-15, j*size-15,30,30, this);	
					 }else if(chess[i][j]==2){
						 g.drawImage(ImageResource.IMAGE_BLACK_NOW, i*size-15, j*size-15,30,30, this);	
					 }
				 }
				 if(chess[i][j]==1){
					 g.drawImage(ImageResource.IMAGE_WHITE, i*size-15, j*size-15,30,30, this);	
				 }else if(chess[i][j]==2){
					 g.drawImage(ImageResource.IMAGE_BLACK, i*size-15, j*size-15,30,30, this);	
				 }
				 
			 }
		 }
		 System.out.println("asd");
	}
	public int[][] getChess() {
		return chess;
	}
	public void setChess(int[][] chess) {
		this.chess = chess;
	}
	public void show(int[][] chess,int posX,int posY){
		this.chess=chess;
		this.posX=posX;
		this.posY=posY;
		repaint();
	}
}
